include ../../../make.settings

CC = $(PLATFORM_CC)
CFLAGS = -std=c99 -Wall

AR = $(PLATFORM_AR)
ARFLAGS = rcs

LIB = ../../lib/

SRC_PACKET_PATH  = ../MQTTPacket/src/
SRC_CLIENT1_PATH = ./src/

SRC_PACKET  = ${wildcard ${SRC_PACKET_PATH}}
SRC_CLIENT1 = ${wildcard ${SRC_CLIENT1_PATH}}

SRC_FILE = ${wildcard ${SRC_PACKET}*.c}
SRC_FILE += ${wildcard ${SRC_CLIENT1}*.c}

INCLUD_PATH = -I$(SRC_PACKET_PATH)
INCLUD_PATH += -I$(SRC_CLIENT1_PATH)
INCLUD_PATH += -I$(SRC_ClIENT2_PATH)
INCLUD_PATH += $(PORTING_INCLUDE)
INCLUD_PATH += -I../../../include/
INCLUD_PATH += -I../../../include/mqtt/
INCLUD_PATH += -I../../../common/inc/
INCLUD_PATH += -I../../../public_libs/mbedtls/
INCLUD_PATH += -I../../../public_libs/mbedtls/include/mbedtls/
INCLUD_PATH += -I../../../platform/$(PLATFORM)/inc/

OBJ = $(patsubst %.c,%.o, ${SRC_FILE})

TARGET_STATIC = $(MQTTMBED_LIB_NAME).a

CFLAGS += ${INCLUD_PATH}

all:$(TARGET_STATIC)

$(TARGET_STATIC):${OBJ}
	$(AR) $(ARFLAGS) $@ $^
   
${OBJ}:%.o:%.c
	$(CC) $(CFLAGS) -c $^ -o $@
	
clean:
	-rm ${OBJ} $(TARGET_STATIC)
	 
	 
